package com.tanguy.user.ui.me.activity.wallet

import android.support.v7.widget.LinearLayoutManager
import com.tanguy.user.App
import com.tanguy.user.R
import com.tanguy.user.base.ImmersionTitleActivity
import com.tanguy.user.bean.RechargeRecord
import com.tanguy.user.net.http.HttpManager
import com.tanguy.user.ui.me.adapter.RechargeRecordAdapter
import com.tanguy.user.utlis.extend.loge
import com.tanguy.user.utlis.extend.requestSucceed
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration
import kotlinx.android.synthetic.main.activity_recharge_record.*
import java.util.*

/**
 * Created by dab on 2017/10/10 0010 10:28
 * 充值记录
 */
class RechargeRecordActivity : ImmersionTitleActivity() {
    override fun setContentViewRes(): Int = R.layout.activity_recharge_record
    private var page = 1
    private val data = ArrayList<RechargeRecord>()
    override fun initView() {
        super.initView()
        title = "充值记录"
        rv_content.layoutManager = LinearLayoutManager(this)
        val rechargeRecordAdapter = RechargeRecordAdapter(data)
        rv_content.adapter = rechargeRecordAdapter
        val item = HorizontalDividerItemDecoration.Builder(this)
                .size(1)
                .colorResId(R.color.dividing_line_color)
                .margin(10, 10)
                .build()
        rv_content.addItemDecoration(item)
        HttpManager.getRechareCord(App.app.user.userId, page)
                .requestSucceed(this) {
                    data.addAll(it)
                    rechargeRecordAdapter.notifyDataSetChanged()
                    loge(it)
                }


    }
}